package com.abc.recycling.service;

import com.abc.recycling.model.Order;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;

public interface OrderService {
    Order createOrder(Order order);
    Order getOrderById(Long id);
    Order updateOrder(Order order);
    void deleteOrder(Long id);
    Page<Order> getOrdersByUserIdPaged(Long userId, Pageable pageable);
    List<Order> getOrdersByUserId(Long userId);
    List<Order> getOrdersByCollectorId(Long collectorId);
    List<Order> getAllOrders();
    void updateOrderStatus(Long orderId, String status);
    void rateOrder(Long orderId, Integer rating, String comment);
    Long countOrdersByStatus(String status);
    List<Map<String, Object>> getOrderTrendData();
    List<Map<String, Object>> getItemDistributionData();
    Long countActiveUsers();
    Double getTotalWeight();
    Double getTotalIncome();
    List<Order> findRecentOrdersByUser(Long userId);
    List<Order> getRecentOrders(int limit);
    Page<Order> findByOrderNo(String orderNo, Pageable pageable);
    Long countTodayOrders();
    Double getTodayTotalWeight();
    Page<Order> searchOrders(String keyword, String status, Pageable pageable);
    List<Map<String, Object>> getMonthlyOrderCount(int months);
    List<Map<String, Object>> getItemDistribution(LocalDateTime startTime, LocalDateTime endTime);
    Double getTotalWeightByStatus(String status);
    Double getAverageRating();
    void exportOrders(String filePath, LocalDateTime startTime, LocalDateTime endTime);
    
    // 添加缺少的方法
    Long countOrdersByUser(Long userId);
    BigDecimal getTotalWeightByUser(Long userId);
    Double getAverageRatingByUser(Long userId);
    BigDecimal getTotalIncomeByUser(Long userId);
    void updateOrderRating(Long orderId, Integer rating, String comment);
    Order findById(Long orderId);
    void cancelOrder(Long orderId);
    Page<Order> findOrders(String keyword, String status, Pageable pageable);
    List<Order> findOrders(String keyword, String status);
    List<Map<String, Object>> getCollectorOrderStats(Long collectorId);
    Page<Order> findByCollectorId(Long collectorId, Pageable pageable);
    List<Order> findByCollectorId(Long collectorId);
    List<Map<String, Object>> getOrderTrendByCollector(Long collectorId, LocalDateTime startTime, LocalDateTime endTime);
    List<Map<String, Object>> getItemDistributionByCollector(Long collectorId);
    Long countOrdersByDate(LocalDateTime date);
    List<Order> getOrdersByDateRange(LocalDateTime startTime, LocalDateTime endTime);
    
    // 添加缺失的方法
    Page<Order> findAll(Pageable pageable);
    Page<Order> findByStatus(String status, Pageable pageable);
    Page<Order> findByKeyword(String keyword, Pageable pageable);
    Page<Order> findByStatusAndKeyword(String status, String keyword, Pageable pageable);
    List<Map<String, Object>> getOrderTrend(LocalDateTime startTime);
    List<Map<String, Object>> getItemDistribution();
    Map<String, Object> getOrderStats();
    
    /**
     * 查询所有订单并关联用户和回收员信息
     */
    Page<Order> findAllOrdersWithUserInfo(Pageable pageable);
} 